package com.suixingpay.seckill.controller;

import com.suixingpay.seckill.pojo.Result;
import com.suixingpay.seckill.service.DistributionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

@Controller
@RequestMapping("/distribution")
public class DistributionController {

    //票的数量
    private final String USER_KEY = "tickets";
    //消息存放key
    private final String TICKET_MESSAGE = "ticket:buy:message";

    @Autowired
    DistributionService distributionService;

    @Autowired
    JedisPool jedisPool;
    Jedis jedis = null;

    @Autowired
    StringRedisTemplate stringRedisTemplate;

    @PostMapping("/seckill")
    public Result seckill(int userId,int activityId){
        //获取redis
        try {
            jedis = jedisPool.getResource();
        }catch (RuntimeException e){
            e.getMessage();
        }


        return new Result();
    }

}
